/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package csp;

/**
 *
 * @author Leandro
 */
public class HeuVarSimple implements HeuristicaVariable {

    public Variable getNextVariable(CSP problema) {

        //Variable nextVariable = null;
        int indice=-1;
        for (Variable v : problema.getVariables()) {
            if (v.getAsignado() == null) {
                indice=problema.getVariables().indexOf(v);

            }

        }
        if(indice != -1){
            problema.setVariablePorAsignar(indice);
            return problema.getVariables().get(indice);
        }else{
        return null;
        }
    }

}
